/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.jhelper.unit05.demo;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

/**
 *
 * @author Administrator
 */
public class GetRandomDemo1 {
    public static void main(String[] args) {
        
        byte[] buff = new byte[100];
        ByteArrayOutputStream o = new ByteArrayOutputStream(100);
        
        for (int i = 0; i < 99; i++) {
            o.write((int)(Math.random()*255+1));
        }
        
        buff = o.toByteArray();
        
        ByteArrayInputStream b = new ByteArrayInputStream(buff);
        int temp= 0;
        while((temp = b.read())!=-1){
            System.out.println(temp+ " ");
        }
        System.out.println();
        
    }

}
